Subscript for arrays and strings

Basic syntax (x(y))

Usage

x(y)

Extracts the y element from string x.

x(y To z)

Extracts the y to z range of elements from string x.

x(n)

Extracts the n element of array x.

Note:    The subscript ranges are 1-based; they start at 1 rather than 0.

Subscript is used to extract one or more characters from a text string or to extract an element from an array.

Examples

The following examples are applicable to Basic syntax:

LNAME (1)

Returns "S", where LNAME = "Smith".

Postal (6)

Returns "V", where Postal Code = "T5A 9V2" (the space between A and 9 counts as an element).

{customer.POSTAL CODE} (5 to 7)

Returns "9V2", where Postal Code = T5A 9V2.

{file.ITEMNUMBER} (4 to 5)

Returns "40", where ItemNumber is A1/4020/B10.

Comments

'declare array MyName

Dim MyName () As String

MyName = Array ("Company A", "Company B", "Company C")

'reference array by its name

formula = MyName (1)

Related topics

Crystal Syntax (x[y])

Crystal Syntax (x[y])

Usage

x[y]

Extracts the y element from string x.

x[y to z]

Extracts the y to z range of elements from string x.

x[n]

Extracts the n element of array x.

Note:    The subscript ranges are 1-based; they start at 1 rather than 0.

Subscript is used to extract one or more characters from a text string or to extract an element from an array.

Examples

The following examples are applicable to Crystal syntax:

[100,233,466,998][3]

Returns 466; 466 is the third element in the array.

LNAME [1]

Returns "S", where LNAME = "Smith".

Postal [6]

Returns "V", where Postal Code = "T5A 9V2" (the space between A and 9 counts as an element).

{customer.POSTAL CODE} [5 to 7]

Returns "9V2", where Postal Code = "T5A 9V2".

{file.ITEMNUMBER} [4 to 5]

Returns "40", where ItemNumber is A1/4020/B10.

Comments

Do not confuse Subscript with In String operator.

While Subscript tests a target string for the presence of an element and extracts the element (if found) from the string, In String only tests the target string for the presence of the element.

Related topics

Basic syntax (x(y))

Formula 1

Formula 2

Formula 3

Formula 9

Formula 11



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com